#include<stdio.h>
#include<string.h>

#define LEN 20

struct person {
    char name[20];
    int age;
};


int main() {
    // 1. 
    struct person p;
    strcpy(p.name, "Tom");
    p.age = 20;

    printf("p.name : %s\n", p.name); // Tom
    printf("p.age : %d\n", p.age); // 20

    // 2. 
    struct person p2 = {
        "Jack",
        19
    };
    printf("p2.name : %s\n", p2.name); // Jack
    printf("p2.age : %d\n", p2.age); // 19


    // 3. declare pointer to structure
    struct person * ptr;
    ptr = &p;
    printf("ptr->name: %s\n", ptr->name); // Tom
    printf("ptr->age: %d\n", ptr->age);   // age

    return 0;
}